VocaChart={
	pie:function($placeholder,data){
		$.plot($placeholder, data, {
			series: {
				pie: { 
					show: true
				}
			}
		});
	},
	stackbar:function($placeholder,dataset,options){
		$.plot($placeholder, dataset, options||{});
	}
}

function showTooltip(x, y, color, contents) {
	$('<div id="tooltip">' + contents + '</div>').css({
		position: 'absolute',
		display: 'none',
		top: y-10,
		left: x - 40,
		border: '2px solid ' + color,
		padding: '3px',
		'font-size': '9px',
		'border-radius': '5px',
		'background-color': '#fff',
		'font-family': 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
		opacity: 0.9
	}).appendTo("body").fadeIn(200);
}


$.fn.chartTooltip = function (formatter) {
	var previousPoint=null,previousLabel=null;
	$(this).bind("plothover", function (event, pos, item) {
		if (item) {
			  if ((previousLabel != item.series.label) || (previousPoint != item.dataIndex)) {
                previousPoint = item.dataIndex;
                previousLabel = item.series.label;
                $("#tooltip").remove();
 
                var x = item.datapoint[0];
                var y = item.datapoint[1];

                var color = item.series.color;
 
				showTooltip(item.pageX,
					item.pageY,
					color,
					formatter(item)
				);
			}
		} else {
			$("#tooltip").remove();
			previousPoint = null;
        }
    });
};
